lexer grammar AnalexANTLR;

options {
  language = Java;
}
 
@lexer::header {
  package Practica6.Ambiguedad;
}

@lexer::members {
  private ArrayList<String> errors = new ArrayList<String>();
  public void displayRecognitionError(String[] tokenNames, RecognitionException e) {
    String hdr = getErrorHeader(e);
    String msg = getErrorMessage(e, tokenNames);
    errors.add(hdr + " " + msg);
  }
   
  public ArrayList<String> getErrors() {
    return errors;
  }
}

fragment SALTO_LINEA:  ('\r' '\n' | '\r' | '\n');
fragment TOKEN_ID: 'A'..'Z' ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;
fragment RULE_ID: 'a'..'z' ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*;

BLANCO: (' ' | '\t' | SALTO_LINEA) {skip();};
REGLA: (RULE_ID)+;
TOKEN: (TOKEN_ID)+;
LITERAL: ( '"' (~'"')* '"' | '\'' (~'\'')* '\'');

COLON: ':';
SEPARADOR: ';'; 
LEFT_PAREN: '(';
RIGHT_PAREN: ')';
OP_OR: '|';
COMODINES
  : '?'
  | '*'
  | '+'
  ;